import {
  HttpApi
} from '../../../model/index.js'
const httpApi = new HttpApi
Page({
  data: {
    windowHeight: 100,
    start: 1,
    size: 10,
    loading: false,
    records: [],
    showNullImg: false
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    //设置scroll-view高度
    wx.getSystemInfo({
      success: function (res) {
        that.setData({ windowHeight: res.windowHeight });
      }
    });
    this.getData(1, this.data.size);
  },
  getData(_start, _size) {
    this.loading = true
    var _this = this
    httpApi.garbageLog(_start, _size,"").then(res => {
      var arr1 = _this.data.records
      var arr2 = res.data.records
      arr1 = arr1.concat(arr2)
      // console.log("orderList:",res.data)
      _this.setData({
        start: _start,
        records: arr1,
        loading: false
      })
      if (_this.data.records.length == 0) {
        _this.setData({
          showNullImg: true,
        })
      }
      // _this.setNewRecords()
    })
  },
})
